# Maintainer: Alexey Pavlov <alexpux@gmail.com>
# Contributor: Ray Donnelly <mingw.android@gmail.com>

pkgname=autoconf
pkgver=2.69
pkgrel=5
pkgdesc="A GNU tool for automatically configuring source code"
arch=('any')
license=('GPL2' 'GPL3' 'custom')
url="https://www.gnu.org/software/autoconf"
groups=('base-devel')
depends=('awk' 'm4' 'diffutils' 'bash' 'perl')
# for test-suite
makedepends=('gcc-fortran')
install=autoconf.install
source=(https://ftp.gnu.org/pub/gnu/${pkgname}/${pkgname}-${pkgver}.tar.xz{,.sig}
        0001-fix-texinfo.patch
        0002-msys2.patch
        0003-autotest-remove-cr-from-prog-stdout-stderr.patch)
sha256sums=('64ebcec9f8ac5b2487125a86a7760d2591ac9e1d3dbd59489633f9de62a57684'
            'SKIP'
            'ad42ff57d1ff3dd6ba06fe94f913a369f9210963856e8c955efed9a164609a64'
            '9f31df02eb41df57a05ceea1d1442424d1cca63cd9304c953732fa6c65279a5a'
            '74e2135a3f34f5692a77de85c21cb2f0fd8a1dcf396f7fbba7deb0c59faa54eb')

prepare() {
  cd ${srcdir}/${pkgname}-${pkgver}

  patch -p1 -i ${srcdir}/0001-fix-texinfo.patch
  patch -p1 -i ${srcdir}/0002-msys2.patch
  patch -p1 -i ${srcdir}/0003-autotest-remove-cr-from-prog-stdout-stderr.patch
}

build() {
  cd ${srcdir}/${pkgname}-${pkgver}
  ./configure --prefix=/usr
  make
}

check() {
  cd ${srcdir}/${pkgname}-${pkgver}
  make check
}

package() {
  cd ${srcdir}/${pkgname}-${pkgver}
  make DESTDIR=${pkgdir} install

  # license exception
  install -Dm644 COPYING.EXCEPTION \
    $pkgdir/usr/share/licenses/autoconf/COPYING.EXCEPTION

  # conflict with bintuils
  rm -f ${pkgdir}/usr/share/info/standards.info
}
